package com.matrix.java.chap_07.example;
/*
    LinearSearch
 */
public class Case7_06 {
    public static void main(String[] args) {
        int[] list ={1,4,4,2,5,-3,6,2};
        linearSearch(list,4);
    }

    private static int linearSearch(int[] list, int key) {
        for (int i = 0; i < list.length; i++) {
            if (key==list[i]){
                return i;
            }
        }
        return -1;
    }

}
